package com.example.demo.event.listener;

import com.example.demo.event.UserRegisterEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CouponService {

    @EventListener
    public void addCoupon(UserRegisterEvent event) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("[addCoupon][给用户({}) 发放优惠劵]", event.getUserName());
    }
}
